<%@ page import="java.util.*" %>
<%@ page import="com.ea.model.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.lang.Math.*" %>

<h2>Recent Updates</h2>

	<% 
		SimpleDateFormat formatter = new SimpleDateFormat("EEE, MMM d, yyyy");

		List<Article> results = (List<Article>)request.getAttribute("articles");
		
		for(Iterator<Article> it = results.iterator();it.hasNext(); )
		{
			Article a = it.next();

			String d = formatter.format(a.date);
			
			// strip HTML out of article
			String htmlString = a.article.getValue();
			String noHTMLString = htmlString.replaceAll("\\<.*?>","");
			int length = Math.min(95,noHTMLString.length());
			
			
			String link = "<a href=\"/article?articleid="+a.key.getId() + "\">More</a></p>";
				
			out.println("<p><strong>" + d + "</strong> - " + "<i>" + a.title + "</i>" + " : " );
			out.println( noHTMLString.substring(0,length) + "...");
			out.println( link );
		}
		
		
	%>




<h2>I like these sites</h2>
<ul>
	<li><a href="http://www.infoq.com/">Info Q</a>, Enterprise
	Software</li>
	<li><a href="http://www.codingthearchitecture.com/">Coding{the}architecture</a>,
	software architecture</li>
	<li><a href="http://techcrunch.com/">TechCrunch</a>, startups</li>
	<li><a href="http://www.smashingmagazine.com/">Smashing
	Magazine</a>, Design</li>
	<li><a href="http://www.ted.com/">Ted</a>, Free inspiring talks</li>
</ul>